package com.information.controller;

import com.common.entity.information.TbInformation;
import com.common.response.CommonResponse;
import com.github.pagehelper.PageInfo;
import com.information.service.InformationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/information")
public class InformationController {

    @Autowired
    private InformationService informationService;

    @PostMapping("/findPage")
    public PageInfo<TbInformation> findPage(
            @RequestParam(value = "page",defaultValue = "1") Integer page,
            @RequestParam(value = "size",defaultValue = "5") Integer size,
            @RequestBody TbInformation information
    ){
        return informationService.findAll(page,size,information);
    }

    @PutMapping("/updateStatus")
    public CommonResponse updateStatus(Long id,Integer status){
        return informationService.updateStatus(id,status);
    }

}
